<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
	<title>HouDun许愿墙</title>
	<link rel="stylesheet" href="/fhl/Public/css/index.css" />
	<script type="text/javascript" src='/fhl/Public/Js/jquery-1.7.2.min.js'></script>
	<script type="text/javascript" src='/fhl/Public/Js/index.js'></script>
</head>
<body>
	<div id='top'>
		<span id='send'></span>
	</div>
	<div id='main'>
            <?php if(is_array($wishlist)): $i = 0; $__LIST__ = $wishlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><dl class='paper a<?php echo ($vo["color"]); ?>'>
		<dt>
			<span class='username'><?php echo ($vo["username"]); ?></span>
			<span class='num'><?php echo ($vo["num"]); ?></span>
		</dt>
			<dd class='content'><?php echo (phiz_replace($vo["content"] )); ?></dd>
			<dd class='bottom'>
			<span class='time'><?php echo date("Y-m-d H:i",$vo["time_at"]);?></span>
			<a href="" class='close'></a>
			</dd>
		</dl><?php endforeach; endif; else: echo "" ;endif; ?>
	</div>

	<div id='send-form'>
		<p class='title'><span>许下你的愿望</span><a href="" id='close'></a></p>
                <form name='wish'>
			<p>
				<label for="username">昵称：</label>
				<input type="text" name='username' id='username'/>
			</p>
			<p>
				<label for="content">愿望：(您还可以输入&nbsp;<span id='font-num'>50</span>&nbsp;个字)</label>
				<textarea name="content" id='content'></textarea>
				<div id='phiz'>
					<img src="/fhl/Public/Images/phiz/zhuakuang.gif" alt="抓狂" />
					<img src="/fhl/Public/Images/phiz/baobao.gif" alt="抱抱" />
					<img src="/fhl/Public/Images/phiz/haixiu.gif" alt="害羞" />
					<img src="/fhl/Public/Images/phiz/ku.gif" alt="酷" />
					<img src="/fhl/Public/Images/phiz/xixi.gif" alt="嘻嘻" />
					<img src="/fhl/Public/Images/phiz/taikaixin.gif" alt="太开心" />
					<img src="/fhl/Public/Images/phiz/touxiao.gif" alt="偷笑" />
					<img src="/fhl/Public/Images/phiz/qian.gif" alt="钱" />
					<img src="/fhl/Public/Images/phiz/huaxin.gif" alt="花心" />
					<img src="/fhl/Public/Images/phiz/jiyan.gif" alt="挤眼" />
				</div>
			</p>
			<span id='send-btn'></span>
		</form>
	</div>
    <script type="text/javascript">
        $(document).ready(function(){
          btn = $('#send-btn');//获取send按钮
          //console.log(btn);
          //按钮点击响应事件处理
             btn.click(function(){
          URL = '<?php echo U(test);?>';
          username = $('input[name="username"]');
          //console.log(username.val());
         /* if(username.val() == ''){
              console.log(11111);
            alert("用户不能为空");
            username.focus();
            return false;
          }*/
          content = $('#content');
          $.post(URL,{username:username.val(),content:content.val()},
                  function(data){
                      if(data.status==1){
                      //data = eval('(' + data + ')');
                      //if(data.status==0){
                         // console.log(data.content);
                      //}else{
                            console.log(data);
                            wish = '';
                            wish += '<dl class="paper a' + data.color +'">';
                            wish += '<dt><span class="username">' + data.username + '</span>';
                            wish +='<span class="num">NO.' + data.id + '</span></dt>';
                            wish +='<dd class="content">' + data.content + '</dd><dd class="bottom"><span class="time">'
                            wish += data.time_at + '</span><a href="" class="close"></a></dd></dl>'

                            $( '#main').append(wish);
                            $( '#close' ).click();
                        }else{
                            console.log(data);
                            alert(data);
                        }
                      }        
                    );
               });
        });
    </script>
<!--[if IE 6]>
    <script type="text/javascript" src="./Js/iepng.js"></script>
    <script type="text/javascript">
        DD_belatedPNG.fix('#send,#close,.close','background');
    </script>
<![endif]-->
</body>
</html>